<?php
/**
 * Created by PhpStorm.
 * User: Ren
 * Date: 4/10/16
 * Time: 2:26 PM
 */

namespace app\controllers;
use Yii;
use app\models\Uc_user;
use yii\web\Controller;
class RecommendController extends Controller
{
    public function actionShow(){
        if(!empty($_COOKIE['user_id'])){

            $user_id = $_COOKIE['user_id'];
//            $user = $this->getUserInfo($user_id);
            $user = Uc_user::find()
                ->where([
                    'user_id' => $user_id, //user_id => user_id
                    'del_flag' => 0
                ])
                ->one();

            $view = Yii::$app->view;
            $view->params['title'] = "推荐用户";
            PrlikeController::setView($user);


            $uurl = "http://42.96.185.45/chuangwu/web/index.php?r=register/show&referer_id=$user_id";
            return $this->render('recommend', ['user'=>$user, 'url'=>$uurl]);
        }else{
            echo "<script>alert('cookie 不存在')</script>";
            sleep(3);
            $this->redirect(['login/show']);
        }
    }
}